//
//  RootViewController.m
//  baihewang
//
//  Created by ZhuoLaiQiang@Gmail.com on 11-5-29.
//  Copyright 2011年 Mtime. All rights reserved.
//

#import "RootViewController.h"
#import "baihewangAppDelegate.h"
#import "BHHTTPService.h"
#import "PaseHtmlUnit.h"


@implementation RootViewController

@synthesize openFlowView = _openFlowView;

- (void)dealloc
{
    [super dealloc];
    TT_RELEASE_SAFELY(_openFlowView);
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
    
   // self.view.backgroundColor = [UIColor colorWithPatternImage: TTIMAGE( @"main_bg.png" )];
    UIImageView *imageView = [[[UIImageView alloc] initWithImage: [UIImage imageNamed: @"Default.png"]] autorelease];
    imageView.frame = [UIScreen mainScreen].bounds;
    baihewangAppDelegate *delageteApp = [UIApplication sharedApplication].delegate;
    delageteApp.imageView = imageView;
    [delageteApp.window addSubview: imageView];
    
    self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"main_bg.png"]];
    [self performSelectorInBackground: @selector(getHttpCode) withObject: nil];
}

- (void)getAndPaseHttpCode
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    
    NSString *responseHttpcode = [BHHTTPService getStaticHtmlCode: @"http://wap.baihe.com"];
    [PaseHtmlUnit paseRootViewData: responseHttpcode owner: self];
    
    [pool release];
}


- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
   // 
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
